# Contributor: Dermot Bradley <dermot_bradley@yahoo.com>
# Maintainer: Dermot Bradley <dermot_bradley@yahoo.com>
pkgname=fscrypt
pkgver=0.3.4
pkgrel=6
pkgdesc="manage Linux native filesystem encryption"
url="https://github.com/google/fscrypt"
# Tests fail on ppc64le with SIGSEGV and memory lock errors
arch="all !ppc64le"
license="Apache-2.0"
makedepends="
	findutils
	go
	linux-pam-dev
	"
subpackages="$pkgname-doc"
source="$pkgname-$pkgver.tar.gz::https://github.com/google/fscrypt/archive/refs/tags/v$pkgver.tar.gz"

export GOCACHE="${GOCACHE:-"$srcdir/go-cache"}"
export GOTMPDIR="${GOTMPDIR:-"$srcdir"}"
export GOMODCACHE="${GOMODCACHE:-"$srcdir/go"}"

check() {
	go test ./...
}

build() {
	make
}

package() {
	install -D -m755 bin/fscrypt "$pkgdir"/usr/bin/fscrypt

	install -D -m 755 -o root \
		bin/pam_fscrypt.so \
		"$pkgdir"/lib/security/pam_fscrypt.so

	install -D -m644 \
		README.md \
		"$pkgdir"/usr/share/doc/$pkgname/README.md
}

sha512sums="
e99ade63092281f3db948564458ddd259420bb7295c6ad896fb5e22697405aa471725c929cf98631e91c05615141c9715bce3eb1b37cbe7c07a7c7c248117b06  fscrypt-0.3.4.tar.gz
"
